<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Untitled Document</title>
        <script type="text/javascript" src="../../js/jquery/jquery.js">
        </script>
        <script type="text/javascript" src="../../js/jquery/jquery-migrate.js">
        </script>
        <script type="text/javascript" src="../../js/jqueryui/jquery-ui.js">
        </script>
		<script type="text/javascript" src="../../js/ctp/public/jsextend.js">
        </script>
		<script type='text/javascript' src='../../js/ctp/public/ctp.core.js'></script>
		<script type='text/javascript' src='../../js/ctp/public/ctp.base.js'></script>
		<script type='text/javascript' src='../../js/ctp/public/ctp.ui.component.js'></script>		
        <script type="text/javascript" src="../../js/ctp/public/jquery.ctp.jslog.js">
        </script>
        <script type="text/javascript" src="../../js/ctp/panel/ctp.ui.panel.js">
        </script>
		<script type="text/javascript" src="../../js/ctp/groupbox/ctp.ui.groupbox.js">
		</script>
        <script type="text/javascript" src="../../js/ctp/textfield/ctp.ui.textfield.js">
		</script>
        <script type="text/javascript" src="../../js/ctp/label/ctp.ui.label.js">
		</script>
        <script type="text/javascript" src="../../js/jquery.validationEngine.js">
		</script>
        <script type="text/javascript" src="../../js/jquery.validationEngine-cn.js">
        </script>
		<script type="text/javascript" src="../../js/ctp/checkboxgroup/ctp.ui.checkboxgroup.js">
        </script>
		<script type="text/javascript" src="../../js/ctp/radiogroup/ctp.ui.radiogroup.js">
        </script>
        <script type="text/javascript" src="../../js/ctp/button/ctp.ui.button.js">
		</script>
		<script type="text/javascript" src="../../js/ctp/messagebox/ctp.ui.messagebox.js">
		</script>
		<script type="text/javascript" src="../../js/ctp/gridlayout/ctp.ui.gridlayout.js">
        </script>
		<link href="../../css/skins/standard/ctp-common.css" rel="stylesheet" type="text/css"/>
        <link href="../../css/panel.css" rel="stylesheet" type="text/css"/>
        <link href="../../css/textfield.css" rel="stylesheet" type="text/css"/>
		<link href="../../css/validationEngine.jquery.css" rel="stylesheet" type="text/css"/>
		<link href="../../css/checkboxgroup.css" rel="stylesheet" type="text/css"/>
		<link href="../../css/radiogroup.css" rel="stylesheet" type="text/css"/>
        <link href="../../css/button.css" rel="stylesheet" type="text/css"/>
        <link href="../../css/label.css" rel="stylesheet" type="text/css"/>
		<link href="../../css/gridlayout.css" rel="stylesheet" type="text/css"/>
		<link href="../../css/messagebox.css" rel="stylesheet" type="text/css"/>
		<link href="../../css/groupbox.css" rel="stylesheet" type="text/css"/>
        <script>
			//ctp.core.log.lvl=ctp.core.loglvl.info;
            $(document).ready(function(){
				var label1=new ctp.ui.label({
			  	    id: 'label1',
					width: '100%',
					textAlign: 'left',
					text: '居左标签'				   
			     });				
				 var label2=new ctp.ui.label({
			  	    id: 'label2',
					width: '100%',
					textAlign: 'center',
					text: '居中标签'				   
			     });
				 var label3=new ctp.ui.label({
			  	    id: 'label3',
					width: '100%',
					textAlign: 'right',
					text: '居右标签'				   
			     });
				var button1= new ctp.ui.button({
                    id: 'button1',
                    text: '取得组件ID',
                    width: '100%',
                    onClick: function(){						
						ctpMSB.alert({title:'信息提示',message:label1.getId()+","+label2.getId()+","+label3.getId()});                       
                    }
                });
				var button2= new ctp.ui.button({
                    id: 'button2',
                    text: '取得组件名称',
                    width: '100%',
                    onClick: function(){
						ctpMSB.alert({title:'信息提示',message:label1.getName()+","+label2.getName()+","+label3.getName()});						                        
                    }
                });
				var button3= new ctp.ui.button({
                    id: 'button3',
                    text: '取得组件类型',
                    width: '100%',
                    onClick: function(){						  
						ctpMSB.alert({title:'信息提示',message:label1.getCtpWebType()});                      
                    }
                });
				var button4= new ctp.ui.button({
                    id: 'button4',
                    text: '取得组件Dom ID',
                    width: '100%',
                    onClick: function(){						  
						ctpMSB.alert({title:'信息提示',message:label1.getDomId()+","+label2.getDomId()+","+label3.getDomId()});                      
                    }
                });
				var disabled = false;
				var button5= new ctp.ui.button({
                    id: 'button5',
                    text: '禁用/启用',
                    width: '100%',
                    onClick: function(){						  
						label1.setDisable(!disabled);
						label2.setDisable(!disabled);
						label3.setDisable(!disabled);
						disabled = !disabled;
                    }
                });
				var button6= new ctp.ui.button({
                    id: 'button6',
                    text: '是否禁用',
                    width: '100%',
                    onClick: function(){					  
						ctpMSB.alert({
							title: '信息提示',
							message: label1.isDisable()
						});
                    }
                });
				var button7= new ctp.ui.button({
                    id: 'button7',
                    text: '设置组件文本',
                    width: '100%',
                    onClick: function(){						  
						label1.setText('新文本1');
						label2.setText('新文本2');
						label3.setText('新文本3');
                    }
                });
				var button8= new ctp.ui.button({
                    id: 'button8',
                    text: '取得组件文本',
                    width: '100%',
                    onClick: function(){						  
						ctpMSB.alert({title:'信息提示',message:label1.getText()+","+label2.getText()+","+label3.getText()});                      
                    }
                });
				var button9= new ctp.ui.button({
                    id: 'button9',
                    text: '设置组件值',
                    width: '100%',
                    onClick: function(){						  
						label1.setValue('newval1');
						label2.setValue('newval2');
						label3.setValue('newval3');
                    }
                });
				var button10= new ctp.ui.button({
                    id: 'button10',
                    text: '取得组件值',
                    width: '100%',
                    onClick: function(){						  
						ctpMSB.alert({title:'信息提示',message:label1.getValue()+","+label2.getValue()+","+label3.getValue()});                      
                    }
                });
				var button11= new ctp.ui.button({
                    id: 'button11',
                    text: '清空组件文本',
                    width: '100%',
                    onClick: function(){						  
						label1.clearText();
						label2.clearText();
						label3.clearText();
                    }
                });
				var button12= new ctp.ui.button({
                    id: 'button12',
                    text: '删除3个label组件',
                    width: '100%',
                    onClick: function(){						  
						label1.remove();
						label2.remove();
						label3.remove();
                    }
                });
                var showLayout = new ctp.ui.gridlayout({
					id:'showLayout',
                    width: '50%',
                    cols: 1,
                    align: 'center',
                    colSpace: 30,
                    items: [[{element: label1}],
							[{element: label2}],
							[{element: label3}]]
                
                });  
				var showGroupbox=new ctp.ui.groupbox({
			  	    id: 'showGroupbox',						
					items:[showLayout],
					title:'效果展示区'						   
			     });
				var buttonsLayout = new ctp.ui.gridlayout({
					id:'buttonsLayout',
                    width: '98%',
                    cols: 3,
                    align: 'center',
                    colSpace: 30,
                    items: [
					     [{element: button1},{element: button2},{element: button3}],
						 [{element: button4},{element: button5},{element: button6}],
						 [{element: button7},{element: button8},{element: button9}],
						 [{element: button10},{element: button11},{element: button12}]
					]
                
                }); 
				var buttonsGroupbox=new ctp.ui.groupbox({
			  	    id: 'buttonsGroupbox',						
					items:[buttonsLayout],
					width:'100%',
					title:'功能测试区'						   
			     });
				new ctp.ui.panel({
                    title: 'label实例',
                    collapsible: true,
                    width: '550px',
                    height: 'auto',
					align:'center',
					items:[showGroupbox,buttonsGroupbox],
                    renderTo: 'body'
                });            
            });			
        </script>
    </head>
    <BODY>
    	<b>ctp.ui.label实例</b>
		<hr/>
		<br/>
</BODY>
</html>